package com.xzxy.xmlg_backend.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import cn.afterturn.easypoi.excel.annotation.ExcelIgnore;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * <p>
 * 学生表
 * </p>
 *
 * @author 张鑫鹏
 * @since 2025-06-10
 */
@Data
@ApiModel(value = "Student对象", description = "学生表")
@TableName("students")
public class Student implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @ApiModelProperty("ID")
    @ExcelIgnore
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 学号
     */
    @ApiModelProperty("学号")
    @Excel(name = "学号")
    private String studentNo;

    /**
     * 姓名
     */
    @ApiModelProperty("姓名")
    @Excel(name = "姓名")
    private String name;

    /**
     * 邮箱
     */
    @ApiModelProperty("邮箱")
    @Excel(name = "邮箱")
    private String email;

    /**
     * 性别, 说明: 1 男, 2 女
     */
    @ApiModelProperty("性别, 说明: 1 男, 2 女")
    @Excel(name = "性别", replace = {"男_1", "女_2"})
    private Byte gender;

    /**
     * 出生日期
     */
    @ApiModelProperty("出生日期")
    @Excel(name = "出生日期", format = "yyyy-MM-dd")
    private LocalDate birthDate;

    /**
     * 班级ID
     */
    @ApiModelProperty("班级ID")
    @Excel(name = "班级ID")
    private Integer classId;

    /**
     * 入学日期
     */
    @ApiModelProperty("入学日期")
    @Excel(name = "入学日期", format = "yyyy-MM-dd")
    private LocalDate joinDate;

    /**
     * 头像
     */
    @ApiModelProperty("头像")
    @ExcelIgnore
    private String avatar;

    /**
     * 状态, 说明: 1 在读, 0 已离开
     */
    @ApiModelProperty("状态, 说明: 1 在读, 0 已离开")
    @Excel(name = "状态", replace = {"在读_1", "已离开_0"})
    private Byte status;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    private LocalDateTime createdAt;

    /**
     * 修改时间
     */
    @ApiModelProperty("修改时间")
    @ExcelIgnore
    private LocalDateTime updatedAt;


    public void setStatus(Double d) {
        this.status = d == null ? null : d.byteValue();
    }

    public void setGender(Double d) {
        this.gender = d == null ? null : d.byteValue();
    }
}
